﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;

namespace UniversalApp_Sample.ViewModels
{
    public class MainViewModel : INotifyPropertyChanged
    {

        public MainViewModel()
        {
            _stringValue = "ValueFromVM";
        }


        private string _stringValue;

        public string StringValue
        {
            get { return _stringValue; }
            set
            {
                if (_stringValue == value)
                    return;
                _stringValue = value;
                RaisePropertyChanged("StringValue");
            }
        }

        private double _sliderValue;
        public double SliderValue
        {
            get { return _sliderValue; }
            set
            {
                if (_sliderValue == value)
                    return;
                _sliderValue = value;
                RaisePropertyChanged("SliderValue");
            }
        }


        private bool _boolValue;
        public bool BoolValue
        {
            get { return _boolValue; }
            set
            {
                if (_boolValue == value)
                    return;
                _boolValue = value;
                RaisePropertyChanged("BoolValue");
            }
        }

        public void RaisePropertyChanged(string name)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(name));
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }
}
